import axios from 'axios'

const baseURL = 'http://toutiao-app.itheima.net'
const instance = axios.create({
  baseURL,
  timeout: 4000
})

// 请求监听器
instance.interceptors.request.use(config => {
  return config
}, error => {
  return Promise.reject(error)
})

// 请求监听器
instance.interceptors.response.use(reponse => {
  return reponse.data
}, error => {
  return Promise.reject(error)
})

export default instance
